import { expect, test } from 'vitest';

import { highlighter } from '../highlighter';

test('highlighter', () => {
  expect(highlighter('0123456789', '<b>', '</b>', [[3, 5]])).toEqual(
    '012<b>34</b>56789'
  );

  expect(
    highlighter(
      '012345678901234567890123456789012345678901234567890123456789',
      '<b>',
      '</b>',
      [[59, 60]]
    )
  ).toEqual('...0123456789012345678901234567890123456789012345678<b>9</b>');

  expect(
    highlighter(
      '012345678901234567890123456789012345678901234567890123456789',
      '<b>',
      '</b>',
      [
        [10, 11],
        [49, 51],
      ]
    )
  ).toEqual(
    '0123456789<b>0</b>12345678901234567890123456789012345678<b>9</b>...'
  );
});
